package com.qianfeng.smsplatform.webmaster.pojo;


import com.qianfeng.smsplatform.webmaster.utils.CheckPhone;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.ObjectUtils;

@ApiModel("黑名单对象")
public class TBlackList implements CheckNull {
    @ApiModelProperty("主键,添加不传递")
    private Long id;
    @ApiModelProperty("手机号")
    private String mobile;
    @ApiModelProperty("创建者类型")
    private Long owntype;
    @ApiModelProperty("创建者 id")
    private Long creater;
    @ApiModelProperty("创建者的信息")
    private TAdminUser adminUser;

    public TAdminUser getAdminUser() {
        return adminUser;
    }

    public void setAdminUser(TAdminUser adminUser) {
        this.adminUser = adminUser;
    }

    @Override
    public boolean isNull(CheckType type) {
        //如果是添加
        //返回
        switch (type) {
            case ADD:
                return !CheckPhone.isPhone(mobile);
            case UPDATE:
                return ObjectUtils.isEmpty(id)||!CheckPhone.isPhone(mobile);
            case DELETE:

                return false;
        }
        //如果是更新
        //返回 xxx
        return CheckNull.super.isNull(type);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }


    public Long getOwntype() {
        return owntype;
    }

    public void setOwntype(Long owntype) {
        this.owntype = owntype;
    }


    public Long getCreater() {
        return creater;
    }

    public void setCreater(Long creater) {
        this.creater = creater;
    }

    @Override
    public String toString() {
        return "TBlackList{" +
                "id=" + id +
                ", mobile='" + mobile + '\'' +
                ", owntype=" + owntype +
                ", creater=" + creater +
                ", adminUser=" + adminUser +
                '}';
    }
}
